package com.trinity.oldsystem.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.trinity.oldsystem.domain.DhxhStudentCopy;
import com.trinity.oldsystem.service.IDhxhStudentCopyService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.trinity.common.annotation.Log;
import com.trinity.common.core.controller.BaseController;
import com.trinity.common.core.domain.AjaxResult;
import com.trinity.common.enums.BusinessType;
import com.trinity.common.utils.poi.ExcelUtil;
import com.trinity.common.core.page.TableDataInfo;

/**
 * 【请填写功能名称】Controller
 *
 * @author trinity
 * @date 2024-01-16
 */
@RestController
@RequestMapping("/system/copy")
public class DhxhStudentCopyController extends BaseController {
    @Autowired
    private IDhxhStudentCopyService dhxhStudentCopyService;

/**
 * 查询【请填写功能名称】列表
 */
@PreAuthorize("@ss.hasPermi('system:copy:list')")
@GetMapping("/list")
    public TableDataInfo list(DhxhStudentCopy dhxhStudentCopy) {
        startPage();
        List<DhxhStudentCopy> list = dhxhStudentCopyService.selectDhxhStudentCopyList(dhxhStudentCopy);
        return getDataTable(list);
    }

    /**
     * 导出【请填写功能名称】列表
     */
    @PreAuthorize("@ss.hasPermi('system:copy:export')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DhxhStudentCopy dhxhStudentCopy) {
        List<DhxhStudentCopy> list = dhxhStudentCopyService.selectDhxhStudentCopyList(dhxhStudentCopy);
        ExcelUtil<DhxhStudentCopy> util = new ExcelUtil<DhxhStudentCopy>(DhxhStudentCopy. class);
        util.exportExcel(response, list, "【请填写功能名称】数据");
    }

    /**
     * 获取【请填写功能名称】详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:copy:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id) {
        return success(dhxhStudentCopyService.selectDhxhStudentCopyById(id));
    }

    /**
     * 新增【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('system:copy:add')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DhxhStudentCopy dhxhStudentCopy) {
        return toAjax(dhxhStudentCopyService.insertDhxhStudentCopy(dhxhStudentCopy));
    }

    /**
     * 修改【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('system:copy:edit')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
            @PostMapping("/put")
    public AjaxResult edit(@RequestBody DhxhStudentCopy dhxhStudentCopy) {
        return toAjax(dhxhStudentCopyService.updateDhxhStudentCopy(dhxhStudentCopy));
    }

    /**
     * 删除【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('system:copy:remove')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
            @PostMapping("/{ids}/delete")
    public AjaxResult remove(@PathVariable String[] ids) {
        return toAjax(dhxhStudentCopyService.deleteDhxhStudentCopyByIds(ids));
    }
}
